package com.hadoop.mr2.output;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;


public class AuthOutputDriver {
	
	public static void main(String[] args) throws Exception {
		Configuration conf=new Configuration();
		Job job=Job.getInstance(conf);
		
		job.setJarByClass(AuthOutputDriver.class);
		job.setMapperClass(AuthOutPutMapper.class);
		
		job.setMapOutputKeyClass(LongWritable.class);
		job.setMapOutputValueClass(Text.class);
		
		//指定用户自定义的格式输出，如果不指定，Hadoop默认用的TextOutPutFormat.class
		job.setOutputFormatClass(AuthOutputFormat.class);
		
		FileInputFormat.setInputPaths(job, new Path("hdfs://192.168.234.231:9000/word"));
		FileOutputFormat.setOutputPath(job, new Path("hdfs://192.168.234.231:9000/word/result"));
		
		job.waitForCompletion(true);
	}

}
